﻿using Guoc.BigMall.Domain.ValueObject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Guoc.BigMall.Infrastructure.Extension;
using System.ComponentModel;
using Guoc.BigMall.Domain.Entity;
using System.Runtime.InteropServices.WindowsRuntime;

namespace Guoc.BigMall.Application.ViewObject
{
    /// <summary>
    ///  销售综合查询列表明细
    /// </summary>
    public class SaleOrderListDto
    {
        public int Id { get; set; }
        [Description("单号")]
        public string Code { get; set; }
        public int StoreId { get; set; }
        [Description("销售门店")]
        public string StoreName { get; set; }

        public int? OrderType { get; set; }
        public SaleOrderStatus Status { get; set; }

        [Description("订单状态")]
        public string StatusName
        {
            get
            {
                return Status.Description();
            }
        }

        public OrderPayStatus PayStatus { get; set; }

        public string PayStatusName { get { return this.PayStatus.Description(); } }

        public decimal OrderAmount { get; set; }

        public PaymentWay? PaymentWay { get; set; }
        public string PaymentWayName { get { return this.PaymentWay.HasValue ? this.PaymentWay.Value.Description() : string.Empty; } }
        public DateTime? PaidDate { get; set; }
        [Description("销售时间")]
        public string PaidDateTime
        {
            get
            {
                return this.PaidDate.HasValue ? this.PaidDate.Value.ToString("yyyy-MM-dd") : string.Empty;
            }
        }
        public int? Hour { get; set; }
        public int CreatedBy { get; set; }
        [Description("制单人")]
        public String CreatedByName { get; set; }
        public DateTime? CreatedOn { get; set; }
        [Description("制单时间")]
        public string CreatedOnTime
        {
            get
            {
                return CreatedOn.HasValue ? CreatedOn.Value.ToString("yyyy-MM-dd") : string.Empty;
            }
        }
        public int? UpdatedBy { get; set; }
        public DateTime? UpdatedOn { get; set; }

        public string ReceiverTel { get; set; }
        public string ReceiverName { get; set; }

        public string ReceiverAreaFullName { get; set; }
        public string ReceiverAddress { get; set; }

        /// <summary>
        /// 收货人全地址
        /// </summary>
        public string ReceiverFullAddress
        {
            get
            {
                return this.ReceiverAreaFullName + ReceiverAddress;
            }
        }

        [Description("备注")]
        public string Remark { get; set; }
        public string UpdatedByName { get; set; }

        // 明细
        [Description("商品编码")]
        public string ProductCode { get; set; }
        [Description("商品名称")]
        public string ProductName { get; set; }
        [Description("品类名称")]
        public string CategoryName { get; set; }
        [Description("品牌名称")]
        public string BrandName { get; set; }
        [Description("规格")]
        public string Specification { get; set; }

        [Description("售价")]
        public decimal RealPrice { get; set; }


        [Description("数量")]
        public int Quantity { get; set; }

        [Description("金额")]
        public decimal Amount
        {
            get
            {
                return RealPrice * Quantity;
            }
        }

        public string MemberName { get; set; }

        public string MemberId { get; set; }

        public  string ReferId { get; set; }

        public string ReferName { get; set; }

    }
}
